/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.systemcar.dao;

import br.com.systemcar.model.Usuario;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author danilo
 */
@Stateless
public class UsuarioDao {
     @PersistenceContext(unitName="SystemcarPU")
    private EntityManager em;
     
     public Usuario findUser(String email){
         Query query =em.createNamedQuery("Usuario.findByUsrEmail");
         query.setParameter("usrEmail", email);
         Usuario user =(Usuario) query.getSingleResult();
         return user;
     }
    
}
